/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.suli.inventory.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
* @website https://eladmin.vip
* @description /
* @author WYH
* @date 2024-02-01
**/
@Entity
@Data
@Table(name="inventory_detail")
public class InventoryDetail implements Serializable {

    @Id
    @Column(name = "`id`")
    @ApiModelProperty(value = "主键id")
    private String id;

    @Column(name = "`storage_location`")
    @ApiModelProperty(value = "储位")
    private String storageLocation;

    @Column(name = "`inventory_id`")
    @ApiModelProperty(value = "头id")
    private String inventoryId;

    @Column(name = "`grade`")
    @ApiModelProperty(value = "等级")
    private String grade;

    @Column(name = "`unit`")
    @ApiModelProperty(value = "单位")
    private String unit;

    @Column(name = "`batch`")
    @ApiModelProperty(value = "批次")
    private String batch;

    @Column(name = "`warehouse_type`")
    @ApiModelProperty(value = "仓库类型")
    private String warehouseType;

    @Column(name = "`warehouse_location`")
    @ApiModelProperty(value = "库位")
    private String warehouseLocation;

    @Column(name = "`survival_days`")
    @ApiModelProperty(value = "入库天数")
    private Integer survivalDays;

    @Column(name = "`material_group`")
    @ApiModelProperty(value = "物料组")
    private String materialGroup;

    @Column(name = "`vmi_sign`")
    @ApiModelProperty(value = "VMI标志")
    private String vmiSign;

    @Column(name = "`supplier`")
    @ApiModelProperty(value = "供应商")
    private String supplier;

    @Column(name = "`vmi_creattime`")
    @ApiModelProperty(value = "vmi入库时间")
    private Timestamp vmiCreattime;

    @Column(name = "`vmi_retention_days`")
    @ApiModelProperty(value = "vmi滞留天数")
    private Integer vmiRetentionDays;

    @Column(name = "`source_documents`")
    @ApiModelProperty(value = "来源单据")
    private String sourceDocuments;

    @Column(name = "`documents_type`")
    @ApiModelProperty(value = "单据类型")
    private String documentsType;

    @Column(name = "`number`")
    @ApiModelProperty(value = "数量")
    private BigDecimal number;

    public void copy(InventoryDetail source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
